package com.ipet.cart.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.ipet.cart.BaseMapper;
import com.ipet.cart.pojo.Cart;
@Repository
public interface CartMapper extends BaseMapper<Cart>{
	
	@Select("select * from tb_cart where user_id = #{userId}")
	List<Cart> findCartByUserId(@Param("userId") Long userId);
	
	
	void updateNum(Cart cart);
	
	Cart findCartByUserIdAndItemId(Cart cartTemp);
	
	@Delete("delete from tb_cart where user_id=#{userId} and item_id=#{itemId}")
	void deleteCart(Cart cart);
	
	

}
